package com.nextgenapp.wave.gadget
{
	/**
	 * Identifiers for wave modes
	 */
	public class WaveMode
	{
		/** The blip containing the gadget is in an unknown mode. In this case, you should not attempt to edit the blip. */
		public static const UNKNOWN:WaveMode = new WaveMode("unknown");
		
		/** The blip containing the gadget is in view, but not edit mode. */
		public static const VIEW:WaveMode = new WaveMode("view");
		
		/** The blip containing the gadget is in edit mode.	 */
		public static const EDIT:WaveMode = new WaveMode("edit");
		
		/** The blip containing the gadget has changed since the last time it was opened and the gadget should notify this change to the user. */
		public static const DIFF_ON_OPEN:WaveMode = new WaveMode("diff_on_open");
		
		/** The blip containing the gadget is in playback mode.  */
		public static const PLAYBACK:WaveMode = new WaveMode("playback");	
		
		private var mode:String = null;
		
		public function WaveMode(mode:String) {
			this.mode = mode;
		}

		/**
		 * translate the object returned by js to as object.
		 */
		public static function unboxMode(modeObj:Object):WaveMode {
			var waveMode:WaveMode = null;
			if (modeObj) {
				if ("unknown" == modeObj) {
					waveMode = UNKNOWN;
				} else if ("view" == modeObj) {
					waveMode = VIEW;
				} else if ("edit" == modeObj) {
					waveMode = EDIT;
				} else if ("diff_on_open" == modeObj) {
					waveMode = DIFF_ON_OPEN;
				} else if ("playback" == modeObj) {
					waveMode = PLAYBACK;
				}
			}
			
			return waveMode;
		}
	}
}